//
//  HJPayVC.m
//  project
//
//  Created by hu on 2019/4/8.
//  Copyright © 2019 健健. All rights reserved.
//

#import "HJPayVC.h"
#import "HJPayCell.h"
#import "HJPayHeaderView.h"

@interface HJPayVC ()
@property (nonatomic,strong)HJPayHeaderView * payHeader;

@end

@implementation HJPayVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navTitle = @"支付";
    [self setupPayButton];
}
-(void)configTableView {
    self.tableViewStyle = UITableViewStylePlain;
    [super configTableView];
    self.tableView.tableHeaderView = [self configTableViewHeaderView];
}
-(UIView *)configTableViewHeaderView {
    HJPayHeaderView *header = [[HJPayHeaderView alloc]init];
    self.payHeader = header;
    header.frame = CGRectMake(0, 0, SCREEN_WIDTH, 192);
    return header;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 3;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    HJPayCell * payCell = [tableView cellForRowAtIndexPath:indexPath];
    if (!payCell) {
        payCell = [[NSBundle mainBundle]loadNibNamed:@"HJPayCell" owner:nil options:nil].firstObject;
    }
    [payCell loadCellMoreWithData:@{} IndexPath:indexPath];
    
    return payCell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 70;
}
- (void)setupPayButton {
    CGFloat btnY = self.view.height - Height_TabBar-30;
    UIButton *releaseButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    releaseButton.frame = CGRectMake(48, btnY, SCREEN_WIDTH - 96, 68);
    [releaseButton setBackgroundImage:[UIImage imageNamed:@"releasebtn"] forState:(UIControlStateNormal)];
    [releaseButton setTitle:@"立即支付" forState:(UIControlStateNormal)];
    releaseButton.titleLabel.font = [UIFont boldSystemFontOfSize:18];
    releaseButton.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 8, 0);
    [releaseButton addTarget:self action:@selector(releaseTeamButtonClicked) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:releaseButton];
}

-(void)releaseTeamButtonClicked {
    NSLog(@"立即支付");
    [self.navigationController popViewControllerAnimated:YES];
}
@end
